package com.nt.train.controller;
import com.nt.train.dto.RequestDto;
import com.nt.train.service.IRequestStrategy;
import com.nt.train.service.context.HandlerRequestFactory;
import com.nt.train.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * 外部调用接口
 * @author hlf
 * @version 1.0
 * @date 2022/7/28 8:51
 */
@RestController
@RequestMapping("/actReq")
public class ActReqController {

    @Autowired
    private HandlerRequestFactory requestFactory;

    @GetMapping("/test")
    public ResultVo test(@RequestBody RequestDto request) {
        IRequestStrategy requestStrategy = requestFactory.getStrategyByRequest(request.getType());
        return requestStrategy.parseRequestTask(request);
    }
}
